// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-10

package kind

import "fmt"

// FinanceKind
// 财务类别.
type FinanceKind int

const (
	FinanceKindPurchase FinanceKind = 1001
)

var (
	financeKindTexts = map[FinanceKind]string{
		FinanceKindPurchase: "采购",
	}
	financeKindTextUnknown = "未知"

	// financeKindPages
	// 小程序详情页名称.
	financeKindPages = map[FinanceKind]string{
		FinanceKindPurchase: "me.master.shop.stock",
	}
	financeKindPageUndefined = ""

	financeKindFlags       = map[FinanceKind]string{}
	financeKindFlagUnknown = ""
)

// Flag
// 标记.
func (o FinanceKind) Flag() string {
	if flag, ok := financeKindFlags[o]; ok {
		return flag
	}
	return financeKindFlagUnknown
}

func (o FinanceKind) Page() string {
	if page, ok := financeKindPages[o]; ok {
		return page
	}
	return financeKindPageUndefined
}

// Text
// 文本.
func (o FinanceKind) Text() string {
	if text, ok := financeKindTexts[o]; ok {
		return text
	}
	return financeKindTextUnknown
}

// +---------------------------------------------------------------------------+
// | Interface methods                                                         |
// +---------------------------------------------------------------------------+

// ToPurchase
// 采购内容.
//
// return "采购[24]瓶[哇哈哈纯净水]"
func (o FinanceKind) ToPurchase(stock GoodsStock, unit GoodsUnit, cost Balance, name string) string {
	return fmt.Sprintf(`采购 [%d] %s [%s] 共支出 [%v] 元`, stock, unit.Text(), name, cost)
}
